#include "biplTypes.h"
#include <typeinfo>
#include <cstdlib>
#include <iostream>
#include <sstream>
#include <fstream>

#define TYPE_CONVERT_TEST 1

int main() {

	std::stringstream oss;
	std::ofstream outfile;
	int err = 0;

	outfile.open("testtypeout.txt", std::ios::out);

	/// Negation Operator
	//std::cout<<"-----------Negation Operator------------"<<std::endl;
	oss.str(""); oss << boolTypes(true);
	if(oss.str() != "true") {outfile << "error 0\n";  err++;}
	oss.str(""); oss << -boolTypes(true);
	if(oss.str() != "-1") {outfile << "error 1\n";err++;}
	oss.str(""); oss << -intTypes(1);
	if(oss.str() != "-1") {outfile << "error 2\n";err++;}
	oss.str(""); oss << -floatTypes(0.0f);
	if(oss.str() != "-0") {outfile << "error 3\n";err++;}
	oss.str(""); oss << -pairTypes(-1.0f, -2.0f);
	if(oss.str() != "[1, 2]") {outfile << "error 4\n";err++;}
	oss.str(""); oss << -degreeTypes(-100);
	if(oss.str() != "[100]") {outfile << "error 5\n";err++;}

	///Arithmetic Operators
	{
		boolTypes ba(true), bb(false);
		intTypes ia(33);
		floatTypes fa(22.2f);
		degreeTypes d(1.1f);
		pairTypes p(4.4f, 4.4f);

		oss.str(""); oss << ba + bb;
		if(oss.str() != "1") {outfile << "error 6\n";err++;}
		oss.str(""); oss << ba - bb;
		if(oss.str() != "1") {outfile << "error 7\n";err++;}
		oss.str(""); oss << ba * bb;
		if(oss.str() != "0") {outfile << "error 8\n";err++;}
		oss.str(""); oss << ba / bb;
		if(oss.str() != "1") {outfile << "error 9\n";err++;}
		oss.str(""); oss << ba % bb;
		if(oss.str() != "1") {outfile << "error 10\n";err++;}

		oss.str(""); oss << ia + ba;
		if(oss.str() != "34") {outfile << "error 11\n";err++;}
		oss.str(""); oss << ia - ba;
		if(oss.str() != "32") {outfile << "error 12\n";err++;}
		oss.str(""); oss << ia * ba;
		if(oss.str() != "33") {outfile << "error 13\n";err++;}
		oss.str(""); oss << ia / ba;
		if(oss.str() != "33") {outfile << "error 14\n";err++;}
		oss.str(""); oss << ia % ba;
		if(oss.str() != "0" ) {outfile << "error 15\n";err++;}

		oss.str(""); oss << fa + ba;
		if(oss.str() != "23.2" ) {outfile << "error 16\n";err++;}
		oss.str(""); oss << fa - ba;
		if(oss.str() != "21.2" ) {outfile << "error 17\n";err++;}
		oss.str(""); oss << fa * ba;
		if(oss.str() != "22.2" ) {outfile << "error 18\n";err++;}
		oss.str(""); oss << fa / ba;
		if(oss.str() != "22.2" ) {outfile << "error 19\n";err++;}
		oss.str(""); oss << fa % ba;
		if(oss.str() != "0.200001"  ) {outfile << " error 20\n";err++;}

		oss.str(""); oss << d + ba;
		if(oss.str() != "[2.1]"  ) {outfile << "error 21\n";err++;}
		oss.str(""); oss << d - ba;
		if(oss.str() != "[0.1]"  ) {outfile << "error 22\n";err++;}
		oss.str(""); oss << d * ba;
		if(oss.str() != "[1.1]"  ) {outfile << "error 23\n";err++;}
		oss.str(""); oss << d / ba;
		if(oss.str() != "[1.1]"  ) {outfile << "error 24\n";err++;}
		oss.str(""); oss << d % ba;
		if(oss.str() != "[0.1]"  ) {outfile << "error 25\n";err++;}

		oss.str(""); oss << p + ba;
		if(oss.str() != "[5.4, 5.4]"  ) {outfile << "error 26\n";err++;}
		oss.str(""); oss << p - ba;
		if(oss.str() != "[3.4, 3.4]"  ) {outfile << "error 27\n";err++;}
		oss.str(""); oss << p * ba;
		if(oss.str() != "[4.4, 4.4]"  ) {outfile << "error 28\n";err++;}
		oss.str(""); oss << p / ba;
		if(oss.str() != "[4.4, 4.4]"  ) {outfile << "error 29\n";err++;}
		oss.str(""); oss << p % ba;
		if(oss.str() != "[0.4, 0.4]"  ) {outfile << "error 30\n";err++;}
		///FIXME : should should work?
		//bb = ba *= bb;

		oss.str(""); oss <<fa + ia;
		if(oss.str() != "55.2"  ) {outfile << "error 31\n";err++;}
		oss.str(""); oss << fa - ia;
		if(oss.str() != "-10.8"  ) {outfile << "error 32\n";err++;}
		oss.str(""); oss << fa * ia;
		if(oss.str() != "732.6"  ) {outfile << "error 33\n";err++;}
		oss.str(""); oss << fa / ia;
		if(oss.str() != "0.672727"  ) {outfile << "error 34\n";err++;}
		oss.str(""); oss << fa % ia;
		if(oss.str() != "22.2"  ) {outfile << "error 35\n";err++;}

		oss.str(""); oss << d + ia;
		if(oss.str() != "[34.1]"  ) {outfile << "error 36\n";err++;}
		oss.str(""); oss << d - ia;
		if(oss.str() != "[-31.9]"  ) {outfile << "error 37\n";err++;}
		oss.str(""); oss << d * ia;
		if(oss.str() != "[36.3]"  ) {outfile << "error 38\n";err++;}
		oss.str(""); oss << d / ia;
		if(oss.str() != "[0.0333333]"  ) {outfile << "error 39\n";err++;}
		oss.str(""); oss << d % ia;
		if(oss.str() != "[1.1]"  ) {outfile << "error 40\n";err++;}

		oss.str(""); oss << p + ia;
		if(oss.str() != "[37.4, 37.4]"  ) {outfile << "error 41\n";err++;}
		oss.str(""); oss << p - ia;
		if(oss.str() != "[-28.6, -28.6]"  ) {outfile << "error 42\n";err++;}
		oss.str(""); oss << p * ia;
		if(oss.str() != "[145.2, 145.2]"  ) {outfile << "error 43\n";err++;}
		oss.str(""); oss << p / ia;
		if(oss.str() != "[0.133333, 0.133333]"  ) {outfile << "error 44\n";err++;}
		oss.str(""); oss << p % ia;
		if(oss.str() != "[4.4, 4.4]"  ) {outfile << "error 45\n";err++;}

		oss.str(""); oss << d + fa;
		if(oss.str() != "[23.3]"  ) {outfile  << "error 46\n";err++;}
		oss.str(""); oss << d - fa;
		if(oss.str() != "[-21.1]"  ) {outfile << "error 47\n";err++;}
		oss.str(""); oss << d * fa;
		if(oss.str() != "[24.42]"  ) {outfile << "error 48\n";err++;}
		oss.str(""); oss << d / fa;
		if(oss.str() != "[0.0495495]"  ) {outfile << "error 49\n";err++;}
		oss.str(""); oss << d % fa;
		if(oss.str() != "[1.1]"  ) {outfile << "error 50\n";err++;}

		oss.str(""); oss << p + fa;
		if(oss.str() != "[26.6, 26.6]"  ) {outfile << "error 51\n";err++;}
		oss.str(""); oss << p - fa;
		if(oss.str() != "[-17.8, -17.8]"  ) {outfile << "error 52\n";err++;}
		oss.str(""); oss << p * fa;
		if(oss.str() != "[97.68, 97.68]"  ) {outfile << "error 53\n";err++;}
		oss.str(""); oss << p / fa;
		if(oss.str() != "[0.198198, 0.198198]"  ) {outfile << "error 54\n";err++;}
		oss.str(""); oss << p % fa;
		if(oss.str() != "[4.4, 4.4]"  ) {outfile << "error 55\n";err++;}

		oss.str(""); oss << p + d;
		if(oss.str() != "[5.5, 5.5]"  ) {outfile << "error 56\n";err++;}
		oss.str(""); oss << p - d;
		if(oss.str() != "[3.3, 3.3]"  ) {outfile << "error 57\n";err++;}
		oss.str(""); oss << p * d;
		if(oss.str() != "[4.84, 4.84]"  ) {outfile << "error 58\n";err++;}
		oss.str(""); oss << p / d;
		if(oss.str() != "[4, 4]"  ) {outfile << "error 59\n";err++;}
		oss.str(""); oss << p % d;
		if(oss.str() != "[0, 0]"  ) {outfile << "error 60\n";err++;}

		//oss.str(""); oss << stringTypes("testString") + ba + bb + ia + fa + d + p << '\n';
		//outfile << oss.str();
	}

	/// Relational Operators
	{
		intTypes ia(3), ib(4);
		floatTypes fa(3.0f), fb(4.2f);
		//std::cout<<"-------Relational Operators------------"<<std::endl;
		//std::cout<< "----int & int----" <<std::endl;
		oss.str(""); oss << (ia < ib);
		if(oss.str() != "true"  ) {outfile << "error 61\n";err++;}
		oss.str(""); oss << (ia > ib);
		if(oss.str() != "false"  ) {outfile << "error 62\n";err++;}
		oss.str(""); oss << (ia <= ib);
		if(oss.str() != "true"  ) {outfile << "error 63\n";err++;}
		oss.str(""); oss << (ia >= ib);
		if(oss.str() != "false"  ) {outfile << "error 64\n";err++;}
		//std::cout<< "----float & int----" <<std::endl;
		oss.str(""); oss << (fa < ia);
		if(oss.str() != "false"  ) {outfile << "error 65\n";err++;}
		oss.str(""); oss << (fa > ia);
		if(oss.str() != "false"  ) {outfile << "error 66\n";err++;}
		oss.str(""); oss << (fa <= ia);
		if(oss.str() != "true"  ) {outfile << "error 67\n";err++;}
		oss.str(""); oss << (fa >= ia);
		if(oss.str() != "true"  ) {outfile << "error 68\n";err++;}
		//std::cout<< "-----int & float----" <<std::endl;
		oss.str(""); oss << (ia < fb);
		if(oss.str() != "true"  ) {outfile << "error 69\n";err++;}
		oss.str(""); oss << (ia > fb);
		if(oss.str() != "false"  ) {outfile << "error 70\n";err++;}
		oss.str(""); oss << (ia <= fb);
		if(oss.str() != "true"  ) {outfile << "error 71\n";err++;}
		oss.str(""); oss << (ia >= fb);
		if(oss.str() != "false"  ) {outfile << "error 72\n";err++;}
		//std::cout<< "----float & float----" <<std::endl;
		oss.str(""); oss << (fa < fb);
		if(oss.str() != "true"  ) {outfile << "error 73\n";err++;}
		oss.str(""); oss << (fa > fb);
		if(oss.str() != "false"  ) {outfile << "error 74\n";err++;}
		oss.str(""); oss << (fa <= fb);
		if(oss.str() != "true"  ) {outfile << "error 75\n";err++;}
		oss.str(""); oss << (fa >= fb);
		if(oss.str() != "false"  ) {outfile << "error 76\n";err++;}
		//std::cout<< "----bool & int----" <<std::endl;
		oss.str(""); oss << (boolTypes(true) < ia);
		if(oss.str() != "true"  ) {outfile << "error 77\n";err++;}
		//std::cout << (true < false) << std::endl;
	}
	/*
	if (boolTypes(true))
	outfile << "if (boolTypes true)\n";

	if (intTypes(1))
	std::cout << "if (intTypes true)" << std::endl;
	if (intTypes(0))
	; else std::cout << "if (intTypes false)" << std::endl;
	if (intTypes(1) - intTypes(1))
	; else std::cout << "if (intTypes false)" << std::endl;
	*/
	/// Logical Operators
	//std::cout<<"-------------Logical Operators-----------"<<std::endl;
	oss.str(""); oss << !intTypes(1);
	if(oss.str() != "false"  ) {outfile << "error 78\n";err++;}
	oss.str(""); oss << !pairTypes(1.0f, 2.0f);
	if(oss.str() != "false"  ) {outfile << "error 79\n";err++;}
	oss.str(""); oss << !degreeTypes(0.0f);
	if(oss.str() != "true"  ) {outfile << "error 80\n";err++;}
	oss.str(""); oss << !stringTypes("");
	if(oss.str() != "true"  ) {outfile << "error 81\n";err++;}
	oss.str(""); oss << !boolTypes(false);
	if(oss.str() != "true"  ) {outfile << "error 82\n";err++;}
	/*
	if (!intTypes(1) - intTypes(1))
	outfile << "if (!intTypes(1) - intTypes(1))\n";
	*/
#if TYPE_CONVERT_TEST
	//std::cout<<"--------------- Type Conversion Test ------------------"<<std::endl;

	/// Convert to String test 
	//std::cout<<"------------- to string -------------"<<std::endl;
	oss.str(""); oss << pairTypes(123.1f, 456).toString();
	if(oss.str() != "[123.1, 456]"  ) {outfile << "error 83\n";err++;}
	oss.str(""); oss << typeid(pairTypes(123.1f, 456).toString()).name();
	if(oss.str() != "class stringTypes"  ) {outfile << "error 84\n";err++;}
	oss.str(""); oss << degreeTypes(0.2f).toString(); 
	if(oss.str() != "[0.2]"  ) {outfile << "error 85\n";err++;}
	oss.str(""); oss << typeid(degreeTypes(0.2f).toString()).name();
	if(oss.str() != "class stringTypes") {outfile << "error 86\n";err++;}
	oss.str(""); oss << intTypes(1).toString(); 
	if(oss.str() != "1"  ) {outfile << "error 87\n";err++;}
	oss.str(""); oss << typeid(intTypes(1).toString()).name();
	if(oss.str() != "class stringTypes") {outfile << "error 88\n";err++;}
	oss.str(""); oss << floatTypes(0.3f).toString();
	if(oss.str() != "0.3"  ) {outfile << "error 89\n";err++;}
	oss.str(""); oss << typeid(floatTypes(0.3f).toString()).name();
	if(oss.str() != "class stringTypes") {outfile << "error 90\n";err++;}
	oss.str(""); oss << boolTypes(false).toString();
	if(oss.str() != "false"  ) {outfile << "error 91\n";err++;}
	oss.str(""); oss << typeid(boolTypes(false).toString()).name();
	if(oss.str() != "class stringTypes") {outfile << "error 92\n";err++;}
	oss.str(""); oss << boolTypes();
	if(oss.str() != "false"  ) {outfile << "error 93\n";err++;}

	/// Convert to Integer test.
	//std::cout<<"------------- to int -------------"<<std::endl;
	oss.str(""); oss << boolTypes(true).toInteger();if(oss.str() != "1"  ) {outfile << "error 94\n";err++;}
	oss.str(""); oss << typeid(boolTypes(true).toInteger()).name();if(oss.str() != "class intTypes") {outfile << "error 95\n";err++;}
	oss.str(""); oss << boolTypes(false).toInteger();if(oss.str() != "0"  ) {outfile << "error 96\n";err++;}
	oss.str(""); oss << typeid(boolTypes(false).toInteger()).name();if(oss.str() != "class intTypes") {outfile << "error 97\n";err++;}

	oss.str(""); oss << floatTypes(123.3f).toInteger();if(oss.str() != "123"  ) {outfile << "error 98\n";err++;}
	oss.str(""); oss << typeid(floatTypes(123.3f).toInteger()).name();if(oss.str() != "class intTypes") {outfile << "error 99\n";err++;}

	//this line should cause an error.
	//std::cout << p.toInteger() ;

	oss.str(""); oss << stringTypes("123").toInteger();if(oss.str() != "123"  ) {outfile << "error 100\n";err++;}
	oss.str(""); oss << typeid(stringTypes("123").toInteger()).name();if(oss.str() != "class intTypes") {outfile << "error 101\n";err++;}

	/// Convert to Boolean test.
	//std::cout<<"------------- to bool -------------"<<std::endl;
	oss.str(""); oss << boolTypes(true).toBoolean();if(oss.str() != "true"  ) {outfile << "error 102\n";err++;}
	oss.str(""); oss <<typeid(boolTypes(true).toBoolean()).name();if(oss.str() != "class boolTypes") {outfile << "error 103\n";err++;}

	oss.str(""); oss << intTypes(1).toBoolean();if(oss.str() != "true"  ) {outfile << "error 104\n";err++;}
	oss.str(""); oss << typeid(intTypes(1).toBoolean()).name();if(oss.str() != "class boolTypes") {outfile << "error 105\n";err++;}
	oss.str(""); oss << intTypes(-1).toBoolean();if(oss.str() != "true"  ) {outfile << "error 106\n";err++;}
	oss.str(""); oss << typeid(intTypes(-1).toBoolean()).name();if(oss.str() != "class boolTypes") {outfile << "error 107\n";err++;}
	oss.str(""); oss << intTypes(0).toBoolean();if(oss.str() != "false"  ) {outfile << "error 108\n";err++;}
	oss.str(""); oss << typeid(intTypes(0).toBoolean()).name();if(oss.str() != "class boolTypes") {outfile << "error 108\n";err++;}

	oss.str(""); oss << floatTypes(0.0f).toBoolean();if(oss.str() != "false"  ) {outfile << "error 110\n";err++;}
	oss.str(""); oss << typeid(floatTypes(0.0f).toBoolean()).name();if(oss.str() != "class boolTypes") {outfile << "error 111\n";err++;}
	oss.str(""); oss << floatTypes(-0.0f).toBoolean();if(oss.str() != "false"  ) {outfile << "error 112\n";err++;}
	oss.str(""); oss << typeid(floatTypes(-0.0f).toBoolean()).name();if(oss.str() != "class boolTypes") {outfile << "error 113\n";err++;}
	oss.str(""); oss << floatTypes(1.0f).toBoolean();if(oss.str() != "true"  ) {outfile << "error 114\n";err++;}
	oss.str(""); oss << typeid(floatTypes(1.0f).toBoolean()).name();if(oss.str() != "class boolTypes") {outfile << "error 115\n";err++;}

	oss.str(""); oss << pairTypes(1.0f, 1.0f).toBoolean();if(oss.str() != "true"  ) {outfile << "error 116\n";err++;}
	oss.str(""); oss << typeid(pairTypes(1.0f, 1.0f).toBoolean()).name();if(oss.str() != "class boolTypes") {outfile << "error 117\n";err++;}

	//???? only empty string is false ????? 
	oss.str(""); oss << stringTypes("true").toBoolean();if(oss.str() != "true"  ) {outfile << "error 118\n";err++;}
	oss.str(""); oss << typeid(stringTypes("true").toBoolean()).name();if(oss.str() != "class boolTypes") {outfile << "error 119\n";err++;}
	oss.str(""); oss << stringTypes("false").toBoolean();if(oss.str() != "true"  ) {outfile << "error 120\n";err++;}
	oss.str(""); oss << typeid(stringTypes("false").toBoolean()).name();if(oss.str() != "class boolTypes") {outfile << "error 121\n";err++;}
	oss.str(""); oss << stringTypes("1").toBoolean();if(oss.str() != "true"  ) {outfile << "error 122\n";err++;}
	oss.str(""); oss << typeid(stringTypes("1").toBoolean()).name();if(oss.str() != "class boolTypes") {outfile << "error 123\n";err++;}
	oss.str(""); oss << stringTypes("0").toBoolean();if(oss.str() != "true"  ) {outfile << "error 124\n";err++;}
	oss.str(""); oss << typeid(stringTypes("0").toBoolean()).name();if(oss.str() != "class boolTypes") {outfile << "error 125\n";err++;}
	oss.str(""); oss << stringTypes("true ").toBoolean();if(oss.str() != "true"  ) {outfile << "error 126\n";err++;}
	oss.str(""); oss << typeid(stringTypes("true ").toBoolean()).name();if(oss.str() != "class boolTypes") {outfile << "error 127\n";err++;}
	oss.str(""); oss << stringTypes("").toBoolean();if(oss.str() != "false"  ) {outfile << "error 128\n";err++;}
	oss.str(""); oss << typeid(stringTypes("").toBoolean()).name();if(oss.str() != "class boolTypes") {outfile << "error 129\n";err++;}

	/// Convert to Float test.
	//std::cout<<"------------- to float -------------"<<std::endl;
	oss.str(""); oss << boolTypes(true).toFloat();if(oss.str() != "1"  ) {outfile << "error 130\n";err++;}
	oss.str(""); oss << typeid(boolTypes(true).toFloat()).name();if(oss.str() != "class floatTypes") {outfile << "error 131\n";err++;}
	oss.str(""); oss << boolTypes(false).toFloat();if(oss.str() != "0"  ) {outfile << "error 132\n";err++;}
	oss.str(""); oss << typeid(boolTypes(false).toFloat()).name();if(oss.str() != "class floatTypes") {outfile << "error 133\n";err++;}

	oss.str(""); oss << intTypes(333).toFloat();if(oss.str() != "333"  ) {outfile << "error 134\n";err++;}
	oss.str(""); oss << typeid(intTypes(333).toFloat()).name();if(oss.str() != "class floatTypes") {outfile << "error 135\n";err++;}
	oss.str(""); oss << floatTypes(123.3f).toFloat();if(oss.str() != "123.3"  ) {outfile << "error 136\n";err++;}
	oss.str(""); oss << typeid(floatTypes(123.3f).toFloat()).name();if(oss.str() != "class floatTypes") {outfile << "error 137\n";err++;}

	//this line should cause an error.
	//std::cout << p.toFloat() ;

	//????? Won't allow space in string ??????
	oss.str(""); oss << stringTypes("123.3").toFloat();if(oss.str() != "123.3"  ) {outfile << "error 138\n";err++;}
	oss.str(""); oss << typeid(stringTypes("123.3").toFloat()).name();if(oss.str() != "class floatTypes") {outfile << "error 139\n";err++;}
	/*
	std::cout << "string: 123.3 "<< stringTypes(" 123.3").toFloat() << " "<<typeid(stringTypes(" 123.3").toFloat()).name()<< std::endl;
	std::cout << "string: 123.3 "<< stringTypes("123 .3").toFloat() << " "<<typeid(stringTypes("123 .3").toFloat()).name()<< std::endl;
	std::cout << "string: 123.3 "<< stringTypes("123.3 ").toFloat() << " "<<typeid(stringTypes("123.3 ").toFloat()).name()<< std::endl;
	*/
	oss.str(""); oss << stringTypes("1.2E03").toFloat();if(oss.str() != "1200"  ) {outfile << "error 140\n";err++;}
	oss.str(""); oss << typeid(stringTypes("1.2E03").toFloat()).name();if(oss.str() != "class floatTypes") {outfile << "error 141\n";err++;}

	/// Convert to Pair test.
	//std::cout<<"------------- to pair -------------"<<std::endl;
	oss.str(""); oss << boolTypes(true).toPair();if(oss.str() != "[1, 1]"  ) {outfile << "error 142\n";err++;}
	oss.str(""); oss << typeid(boolTypes(true).toPair()).name();if(oss.str() != "class pairTypes") {outfile << "error 143\n";err++;}
	oss.str(""); oss << boolTypes(false).toPair();if(oss.str() != "[0, 0]"  ) {outfile << "error 144\n";err++;}
	oss.str(""); oss << typeid(boolTypes(true).toPair()).name();if(oss.str() != "class pairTypes") {outfile << "error 145\n";err++;}

	oss.str(""); oss << intTypes(333).toPair();if(oss.str() != "[333, 333]"  ) {outfile << "error 146\n";err++;}
	oss.str(""); oss << typeid(intTypes(333).toPair()).name();if(oss.str() != "class pairTypes") {outfile << "error 147\n";err++;}
	oss.str(""); oss << floatTypes(123.3f).toPair();if(oss.str() != "[123.3, 123.3]"  ) {outfile << "error 148\n";err++;}
	oss.str(""); oss << typeid(floatTypes(123.3f).toPair()).name();if(oss.str() != "class pairTypes") {outfile << "error 149\n";err++;}

	/*
	//????stringTypes("[1.2E03]").toPair() This should ouput warning or not????
	std::cout << "string: [1.2E03, 1.2E03] "<< stringTypes("[1.2e03]").toPair() << " "<<typeid(stringTypes("[1.2E03]").toPair()).name()<< std::endl;
	//????stringTypes("[1.2E03,]").toPair() This should ouput warning or not????
	std::cout << "string: [1.2E03, 1.2E03] "<< stringTypes("[1.2e03,]").toPair() << " "<<typeid(stringTypes("[1.2E03,]").toPair()).name()<< std::endl;
	*/
	oss.str(""); oss << stringTypes("[1,234]").toPair();if(oss.str() != "[1, 234]"  ) {outfile << "error 150\n";err++;}
	oss.str(""); oss << typeid(stringTypes("[1,234]").toPair()).name();if(oss.str() != "class pairTypes") {outfile << "error 151\n";err++;}
	oss.str(""); oss << stringTypes("[1.2e-03,123]").toPair();if(oss.str() != "[0.0012, 123]"  ) {outfile << "error 152\n";err++;}
	oss.str(""); oss << typeid(stringTypes("[1.2e-03,123]").toPair()).name();if(oss.str() != "class pairTypes") {outfile << "error 153\n";err++;}
	oss.str(""); oss << stringTypes("[123.3,1.23e-3]").toPair();if(oss.str() != "[123.3, 0.00123]"  ) {outfile << "error 154\n";err++;}
	oss.str(""); oss << typeid(stringTypes("[123.3,1.23e-3]").toPair()).name();if(oss.str() != "class pairTypes") {outfile << "error 155\n";err++;}
	oss.str(""); oss << stringTypes("[123,123]").toPair();if(oss.str() != "[123, 123]"  ) {outfile << "error 156\n";err++;}
	oss.str(""); oss << typeid(stringTypes("[123,123]").toPair()).name();if(oss.str() != "class pairTypes") {outfile << "error 157\n";err++;}
	oss.str(""); oss << stringTypes("[123,123]").toPair().toString();if(oss.str() != "[123, 123]"  ) {outfile << "error 158\n";err++;}
	oss.str(""); oss << typeid(stringTypes("[123,123]").toPair().toString()).name();if(oss.str() != "class stringTypes") {outfile << "error 159\n";err++;}
	oss.str(""); oss << stringTypes("[123,123]").toPair().toString().toPair();if(oss.str() != "[123, 123]"  ) {outfile << "error 160\n";err++;}
	oss.str(""); oss << typeid(stringTypes("[123,123]").toPair().toString().toPair()).name();if(oss.str() != "class pairTypes") {outfile << "error 161\n";err++;}


	/// Convert to Degree test
	//std::cout<<"------------- to degree -------------"<<std::endl;
	oss.str(""); oss << boolTypes(true).toDegree();if(oss.str() != "[1]"  ) {outfile << "error 162\n";err++;}
	oss.str(""); oss << typeid(boolTypes(true).toDegree()).name();if(oss.str() != "class degreeTypes") {outfile << "error 163\n";err++;}
	oss.str(""); oss << boolTypes(false).toDegree();if(oss.str() != "[0]"  ) {outfile << "error 164\n";err++;}
	oss.str(""); oss <<typeid(boolTypes(false).toDegree()).name();if(oss.str() != "class degreeTypes") {outfile << "error 165\n";err++;}

	oss.str(""); oss << intTypes(333).toDegree();if(oss.str() != "[333]"  ) {outfile << "error 166\n";err++;}
	oss.str(""); oss << typeid(intTypes(333).toDegree()).name();if(oss.str() != "class degreeTypes") {outfile << "error 167\n";err++;}
	oss.str(""); oss << floatTypes(123.3f).toDegree();if(oss.str() != "[123.3]"  ) {outfile << "error 168\n";err++;}
	oss.str(""); oss << typeid(floatTypes(123.3f).toDegree()).name();if(oss.str() != "class degreeTypes") {outfile << "error 169\n";err++;}

	oss.str(""); oss << stringTypes("[1.2E03]").toDegree();if(oss.str() != "[1200]"  ) {outfile << "error 170\n";err++;}
	oss.str(""); oss << typeid(stringTypes("[1.2E03]").toDegree()).name();if(oss.str() != "class degreeTypes") {outfile << "error 171\n";err++;}
	oss.str(""); oss << stringTypes("[123]").toDegree();if(oss.str() != "[123]"  ) {outfile << "error 172\n";err++;}
	oss.str(""); oss << typeid(stringTypes("[1.2E03]").toDegree()).name();if(oss.str() != "class degreeTypes") {outfile << "error 173\n";err++;}
	oss.str(""); oss << stringTypes("[123]").toDegree().toString();if(oss.str() != "[123]"  ) {outfile << "error 174\n";err++;}
	oss.str(""); oss << typeid(stringTypes("[123]").toDegree().toString()).name();if(oss.str() != "class stringTypes") {outfile << "error 175\n";err++;}
	oss.str(""); oss << stringTypes("[123]").toDegree().toString().toDegree();if(oss.str() != "[123]"  ) {outfile << "error 176n";err++;}
	oss.str(""); oss << typeid(stringTypes("[123]").toDegree().toString().toDegree()).name();if(oss.str() != "class degreeTypes") {outfile << "error 177\n";err++;}
#endif
	outfile << "There are 178 test cases. " << 178-err <<" passed, " << err << " failed.\n";
	outfile.close();
	return 0;
}